namespace ResumableDownload.View.Converters
{
    using System;
    using System.Globalization;
    using System.Windows;
    using System.Windows.Data;
    using WP7Contrib.Services.DownloadManager;

    public sealed class StateToStopEnabledConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return (DownloaderState)value == DownloaderState.Starting ||
                   (DownloaderState)value == DownloaderState.Processing ||
                   (DownloaderState)value == DownloaderState.PausedNetwork ||
                   (DownloaderState)value == DownloaderState.PausedWaiting;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return DependencyProperty.UnsetValue;
        }
    }
}